package com.user.controller;

import com.user.dao.user.LoginDao;
import com.user.dao.user.QueryPageUser;
import com.user.service.UserService;
import com.user.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : Yu
 * @Date 2023/9/20 23:27
 */

@RestController
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private UserService userService;

    @GetMapping("/sendSMS")
    public R sendSMS(@RequestParam("phone") String phone) {
        return userService.sendSMS(phone);
    }

    @PostMapping("/login")
    public R login(@RequestBody LoginDao loginDao) {
        return userService.login(loginDao);
    }

    //获取用户月度消费
    @GetMapping("/getMonthCost")
    public R getMonthCost(@RequestParam("userId") Integer userId) {
        return userService.getMonthCost(userId);
    }

    @PostMapping("/getUser")
    public R getUser(QueryPageUser queryPageUser) {
        return userService.getUser(queryPageUser);
    }

}
